#!/bin/bash 

path_date=$1
path_h=$2

echo "参数:$path_date,$path_h"

if [ -z "${path_date}" -o  -z "${path_h}" ];then
  echo "参数1、2不能为空"
  exit 1
fi

rec_path="/kunshi1-data/record/"${path_date}/${path_h}
wav_path=/kunshi1-data/wav/${path_date}
wav_path2=${wav_path}/${path_h}

if [ -d $rec_path ]; then
  echo "rec目录存在${rec_path}..." 
else
  echo "rec目录不存在${rec_path}。退出"
  exit 1
fi

if [ -d $wav_path2 ]; then
  echo "wav目录存在${wav_path},开始转换..."
else
  echo "wav目录不存在${wav_path},新建目录"
  if [ -d $wav_path ];then
    mkdir ${wav_path2}
  else
    mkdir ${wav_path}
    mkdir ${wav_path2}
  fi
fi


/home/kunshi/audiorecord/bin/audioconvert -t wav -p ${rec_path} -o ${wav_path2}

echo "执行完成。"

